//
//  RollPictureCell.m
//  CatMusic
//
//  Created by dllo on 15/5/1.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "RollPictureCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

@implementation RollPictureCell

- (void)dealloc
{
    [_cellBackImage release];
    [_photoImage release];
    [_singerLabel release];
    [_songNameLabel release];
    [super dealloc];
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.cellBackImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.cellBackImage];
        [self.cellBackImage release];

        
        self.photoImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.photoImage];
//        self.photoImage.layer.borderWidth = 1;
        [self.photoImage release];
        
                
        self.songNameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.songNameLabel];
        [self.songNameLabel release];
        
        
        self.singerLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.singerLabel];
        [self.singerLabel release];
        
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    [self.cellBackImage setFrame:CGRectMake(WIDTH /WIDTH * 20, HEIGHT / HEIGHT * 5, WIDTH - 40, HEIGHT - 10)];
    [self.cellBackImage setImage:[UIImage imageNamed:@"cellBack"]];
    self.cellBackImage.layer.cornerRadius = 15;
//    self.cellBackImage.layer.borderWidth = 1;
    self.cellBackImage.clipsToBounds = YES;
    
    [self.photoImage setFrame:CGRectMake(WIDTH /WIDTH * 20 + 20, HEIGHT / HEIGHT * 20, WIDTH / WIDTH * 85, HEIGHT / HEIGHT * 85)];
    self.photoImage.layer.cornerRadius = (WIDTH / WIDTH * 85) / 2;
    self.photoImage.clipsToBounds = YES;

    
    
    
    
    
    //    [self.photoImage setFrame:CGRectMake(WIDTH /WIDTH * 20, HEIGHT / HEIGHT * 10, WIDTH / WIDTH * 80, HEIGHT / HEIGHT * 80)];
    
//    [self.songNameLabel setFrame:CGRectMake(WIDTH / WIDTH * 150, HEIGHT / HEIGHT * 30, WIDTH / WIDTH * 200, HEIGHT / HEIGHT * 20)];
    
    [self.songNameLabel setFrame:CGRectMake(WIDTH / WIDTH * 150, HEIGHT / HEIGHT * 30, WIDTH - 20 - WIDTH / WIDTH * 150, HEIGHT / HEIGHT * 20)];
    
    [self.singerLabel setFrame:CGRectMake(WIDTH / WIDTH * 150, HEIGHT / HEIGHT * 70, WIDTH / WIDTH * 300, HEIGHT / HEIGHT * 20)];
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
